package com.sc.nft.mapper;

import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sc.nft.dto.MyWantBuyRecordVO;
import com.sc.nft.dto.MyWantSellRecordVO;
import com.sc.nft.dto.WantBuyOrderPageDetailVO;
import com.sc.nft.entity.SecondEquityPropsOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sc.nft.entity.vo.AdminSecondEquityPropsOrderListVO;
import com.sc.nft.entity.vo.SecondEquityPropTradingTendPageVO;
import com.sc.nft.entity.vo.secondEquityProp.SecondEquityPropBuyOrderPageVO;
import com.sc.nft.entity.vo.secondEquityProp.SecondEquityPropTradingTendDetailsVO;
import com.sc.nft.enums.OrderStatusEnum;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;

/**
 * 二级-权益道具订单表(sc_second_equity_props_order)数据Mapper
 *
 * @author Sun
 * @since 2024-04-07 14:18:41
 * @description 由 Mybatisplus Code Generator 创建
*/
@Mapper
public interface SecondEquityPropsOrderMapper extends BaseMapper<SecondEquityPropsOrder> {

    /**
     * 后台-交易列表
     * @param page
     * @param buyUserTel
     * @param salesUserTel
     * @param firstTitle
     * @param startTime
     * @param endTime
     * @return
     */
    Page<AdminSecondEquityPropsOrderListVO> adminDealEquityPropsPage(Page page, @Param("buyUserTel") String buyUserTel, @Param("salesUserTel")String salesUserTel, @Param("firstTitle")String firstTitle,@Param("startTime") Date startTime,@Param("endTime") Date endTime,@Param("dealStartTime") Date dealStartTime,@Param("dealEndTime") Date dealEndTime);

    /**
     * 获取当日最高价 最低价 成交数量 和 最新成交价
     * @param equityPropsId
     * @return
     */
    SecondEquityPropTradingTendDetailsVO tradingTendDetails(@Param("equityPropsId") Long equityPropsId, @Param("startTime") DateTime startTime,@Param("endTime") Date endTime);

    /**
     * 成交趋势列表
     * @param page
     * @param equityPropsId
     * @return
     */
    Page<SecondEquityPropTradingTendPageVO> flowRecord(Page page,@Param("equityPropsId") Long equityPropsId);

    /**
     * 我买入的订单列表
     * @param page
     * @param userId
     * @param status
     * @return
     */
    Page<SecondEquityPropBuyOrderPageVO> orderPage(Page page,@Param("userId") Long userId,@Param("status") Integer status,@Param("beginTime") DateTime beginTime,@Param("endTime")DateTime endTime);

    /**
     * 我出售的订单列表
     * @param page
     * @param userId
     * @return
     */
    Page<SecondEquityPropBuyOrderPageVO> salesOrderPage(Page page,@Param("userId") Long userId,@Param("beginTime") DateTime beginTime,@Param("endTime")DateTime endTime);
    SecondEquityPropBuyOrderPageVO salesOrderDetail(@Param("userId") Long userId, @Param("orderId") Long orderId);

    /**
     * 获取昨天该商品最后一笔的成交价
     * @param id
     * @return
     */
    SecondEquityPropsOrder selectByRelationIdSubOneDayData(@Param("id") Long id);

    Page<MyWantBuyRecordVO> getByWantBuyOrderId(Page page,@Param("wantBuyOrderId") Long id);
    Page<MyWantSellRecordVO> getByWantSellOrderId(Page page, @Param("wantSellOrderId") Long id);

    SecondEquityPropBuyOrderPageVO buyOrderDetail(@Param("userId") Long userId, @Param("orderId") Long orderId);

    Page<WantBuyOrderPageDetailVO> wantBuyOrderPage(Page mp, @Param("wantBuyOrderId") Long id, @Param("userTel") String userTel, @Param("startOrderTime") Date startOrderTime, @Param("endOrderTime")Date endOrderTime, @Param("startPayTime")Date startPayTime, @Param("endPayTime")Date endPayTime);
    Page<WantBuyOrderPageDetailVO> wantSellOrderPage(Page mp, @Param("wantSellOrderId") Long id, @Param("userTel") String userTel, @Param("startOrderTime") Date startOrderTime, @Param("endOrderTime")Date endOrderTime, @Param("startPayTime")Date startPayTime, @Param("endPayTime")Date endPayTime);

}
